package io.gitee.thinkbungee.utils;

import cn.hutool.system.SystemUtil;

/**
 * @author chenyichang
 * @date 2022/4/18
 */
public class SystemUtils {
    public static final String WINDOWS = "windows";
    public static final String LINUX = "linux";
    public static final String MAC_OS = "mac os";

    /**
     * 获取操作系统
     */
    public static String getSystem() {
        if (SystemUtil.get(SystemUtil.OS_NAME).toLowerCase().contains(WINDOWS)) {
            return WINDOWS;
        } else if (SystemUtil.get(SystemUtil.OS_NAME).toLowerCase().contains(MAC_OS)) {
            return MAC_OS;
        } else {
            return LINUX;
        }
    }

    /**
     * 是否是linux操作系统
     */
    public static Boolean isLinux() {
        return getSystem().equals(LINUX);
    }

}
